<?php
/*!
Application_Model_Model 
REQUIRES db.php

*/

require("db.php");

class Application_Model_Model {
	
	public function search_by_model($model) 
	{
		//! Queries $model.\n
		//! Returns associative array LIKE $model.\n
		
        $model = '%' . $model . '%'; 
        $qstring = "SELECT c.component_id, c.ip_address, c.serial_number, d.device_name, c.last_inspected, b.building_name, c.location, c.component_comments FROM component c, device d, make m, building b WHERE d.device_name LIKE \"" . $model . "\" AND c.device_id = d.device_id AND c.building_id = b.building_id ORDER BY b.building_name, c.location";
	    
		$result = mysql_query($qstring);
	    $compiledResults=array();
	    
		while($row=mysql_fetch_assoc($result)){
			array_push($compiledResults,$row);
	    }
	    return $compiledResults;
	}
	
}
